package com.a2v2.online.store.common.exception;

import com.a2v2.online.store.service.constant.ErrorCode;


public class BaseRuntimeException extends RuntimeException {
    /**
	 * 
	 */
	private static final long serialVersionUID = 2743787135932808702L;
	/**
     * error code.
     */
    private ErrorCode errorCode;    
    /**
     * Constructor.
     *
     * @param pErrorCode error code
     * @param pDescription error description
     */
    public BaseRuntimeException(final ErrorCode pErrorCode) {
        super(pErrorCode.getDescription());
        this.errorCode = pErrorCode;
    }
    /**
     * Constructor.
     *
     * @param pErrorCode error code
     * @param pDescription description
     * @param pThrowable original exception
     */
    public BaseRuntimeException(final ErrorCode pErrorCode, final Throwable pThrowable) {
        super(pErrorCode.getDescription(), pThrowable);
        this.errorCode = pErrorCode;
    }
    /**
     * Gets the current value of error code.
     * @return error code.
     */
    public final ErrorCode getErrorCode() {
        return errorCode;
    }
    /**
     * Sets the new value of error code.
     * @param pErrorCode error code.
     */
    public final void setErrorCode(final ErrorCode pErrorCode) {
        this.errorCode = pErrorCode;
    }
}
